package es.gesfutbol.domini.implementacio;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import es.gesfutbol.domini.ICombinacioPropia;

@Entity
@Table(name="combinacio_propia")
public class CombinacioPropia implements ICombinacioPropia {

	private static final long serialVersionUID = -3957432972585262522L;

	private Long idCombinacioPropia;
	
	private boolean aFixos;
	
	private boolean aDobles;
	
	private String nom;

	private Set<Pronostic> pronostics;
	
	private Set<Penya> penyes;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="idCombPropia", nullable=false, precision=10, scale=0)
	public Long getIdCombinacioPropia() {
		return idCombinacioPropia;
	}

	public void setIdCombinacioPropia(Long idCombinacioPropia) {
		this.idCombinacioPropia = idCombinacioPropia;
	}

	@Column(name="aFixos", nullable=true, columnDefinition="tinyint")
	public boolean isaFixos() {
		return aFixos;
	}

	public void setaFixos(boolean aFixos) {
		this.aFixos = aFixos;
	}

	@Column(name="aDobles", nullable=true, columnDefinition="tinyint")
	public boolean isaDobles() {
		return aDobles;
	}

	public void setaDobles(boolean aDobles) {
		this.aDobles = aDobles;
	}
	
	@Column(name="nom", nullable=true, length=45)
	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	@OneToMany(fetch=FetchType.LAZY, mappedBy="combinacioPropia", cascade=CascadeType.ALL)
	public Set<Pronostic> getPronostics() {
		return pronostics;
	}

	public void setPronostics(Set<Pronostic> pronostics) {
		this.pronostics = pronostics;
	}

	@ManyToMany(mappedBy="combPropies")
	public Set<Penya> getPenyes() {
		return penyes;
	}

	public void setPenyes(Set<Penya> penyes) {
		this.penyes = penyes;		
	}
}